import { defineStore } from 'pinia'
import { ref } from 'vue'

export const userLoginStore = defineStore(
    'userLogin',
    () => {
        const isLogin = ref(false)

        const setIsLogin = (v) => {
            isLogin.value = v
        }

        const id = ref()

        const setId = (u) => {
            id.value = u
        }

        const type = ref()

        const setType = (t) => {
            type.value = t
        }

        const account = ref()
        const setAccount = (a) => {
            account.value = a
        }

        const token = ref()
        const setToken = (t) => {
            token.value = t
        }

        return {
            isLogin,
            setIsLogin,
            id,
            setId,
            type,
            setType,
            account,
            setAccount,
            token,
            setToken
        }
    },
    {
        persist: true
    }
)